/*
    JSPWiki - a JSP-based WikiWiki clone.

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); fyou may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
*/
/*
Edit.jsp, EditContent.jsp, CommentContent.jsp, plain.jsp

*/

//should be part of normalise.less ; help also FF to set default to pre-wrap!
textarea { white-space: pre-wrap; }

//highlight  editor focus fields,  to catch attention to the cursor
.editform, .dialog.find {

    input[type="text"]:focus, textarea:focus {
        background:@wiki-editor-focus;

        //get rid of the default bootstrap highlight -- see forms.less and mixins/form-control-focus
        //outline:0;
        .box-shadow(none);
        border: 1px solid @input-border;
    }

}
.editform input[name=changenote] {
    position: absolute;
    z-index: 2;  //appear on top of the button group
    width: 480px;
}


.editform .commentsignature {
    position: absolute;
    z-index: 2;  //appear on top of the button group
}


.editform .open + .editor-tools  {
    opacity:0;
}

.editor {
    font-family: @font-family-monospace;
    padding: .5em;
	resize: none !important; // disable resizable textareas in Webkit
    background: @wiki-editor-bg;
    color:inherit;
    font-size:90%;
}

//base styling similar to .page-content in Template.Content.less;
.ajaxpreview {

    &:empty:before {
        content:"PREVIEW";
    }

    .hide;
    background: @wiki-preview-bg;
    padding: 0 0 .5em @grid-gutter-width/2; //cannot use margin here, as width=50%
    overflow: auto;
    //-ms-overflow-style: -ms-autohiding-scrollbar;
    border: 2px dashed transparent;

    &.loading {
        border: 2px dashed red;
    }
}

//Layout of editor and preview area

//default: show the editor (and preview) areas at 100%
.edit-area  .col-50,
.edit-area + .resizer + .ajaxpreview.col-50 { width:100%; }

//when livepreview is on, show the ajaxpreview area
.edit-area.livepreview .ajaxpreview { .show; }
.edit-area.livepreview  + .resizer + .ajaxpreview { .show; height:auto !important; }

//when livepreview is on AND previewcolumn (side by side) is on, set width to 50%
.edit-area.livepreview.previewcolumn .col-50 { width:50%; float:left; }


.resizer {
    background: @wiki-resizer;
	cursor:row-resize;
    width:100%;
	height:8px;
    line-height:8px;
    margin-top:4px;
    margin-bottom:.5em;
    border-radius:4px;
    z-index:3;

    &.dragging {
        .progress-striped .progress-bar;
        .progress.active .progress-bar;
    }
}


//CHECK: move to dropdown.less ..
//reset bootstrap/form.less style on labels inside dropdown menu-s
.dropdown-menu {
    label { font-weight: normal; }
}

.toolbar {

    padding-bottom: 1em;
    .btn-group {
        border:1px solid @link-color;
	    border-radius:@border-radius-base;
    }
    .btn-link:hover { text-decoration:none; }

}

/*
Horizontal Dropdown Menu (based on bootstrap)
FIXME: used a hack to fix the min-width of the default dropdown menu ; there must be a better way !
*/
ul.dropdown-menu.dropdown-menu-horizontal {

	margin-right: -1000px;

    .list-unstyled();

    > li {
        display: inline-block;
        padding: 0;
        margin: 0;
    }
    > li a { padding: @padding-base-vertical @padding-base-horizontal/2; }
    > li:first-child { padding-left: @padding-base-horizontal; }
    > li:last-child { padding-right: @padding-base-horizontal; }

}

// icons only, or text labels ?
// [data-cmd] { &:after { content: " " attr(data-cmd);  } }

[data-cmd='find'] + .dropdown-menu {

    padding:5px 20px;
    background-color: fade(@dropdown-bg,80%); //white background

    .tbHITS {
    	position:absolute;
	    right:1.5em;
	    color:#999;
    }

}

[data-cmd='color'] {
    background:url("@{imagePath}/color-wheel.png") no-repeat center;
}

/* Section command button and dropdown */
.section-selected > .btn { color:@red; }  //red section button (bookmark) when a section is selected

.sections {
    //.indent-0 { }
    .indent-1 { text-indent:.5em; }
    .indent-2 { text-indent:1em; }
}


/*
General styles to support wysiwyg editors
*/
.editform.wysiwyg {

    .ajaxpreview {
        padding:1em;
        //font-size: 90%;
        font-family: @font-family-monospace;
        white-space: pre-wrap;  //Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
        border:1px solid silver;
        word-wrap:normal;

    }

}

